﻿using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using SilveR.Views.StatsViews;

namespace SilveR.GUIValidators
{
    public static class SummaryStatsGUIValidator
    {
        public static ValidationResult CheckListVarSet(ObservableCollection<ColumnInfo> columnList, ValidationContext context)
        {
            return BasicGUIValidator.CheckListVarSet(columnList, context);
        }

        public static ValidationResult ValidateConfidenceLimits(string confidenceLimit, ValidationContext context)
        {
            SummaryStatsVariables ss = (SummaryStatsVariables)context.ObjectInstance;

            //check that the value in the confidence limits box is not less than 0 and not greater than 1
            int value = ss.ConfidenceLimits;

            if (value < 0 || value > 100)
            {
                return new ValidationResult("You have selected a confidence limit that is less than 0 or greater than 100. Values should be entered as percentages and not fractions.");
            }
            else
                return ValidationResult.Success;
        }
    }
}